#
# This py2exe setup script builds docindexer win32 executables.
#

from distutils.core import setup
import py2exe
import sys

# If run without args, build executables.
if len(sys.argv) == 1:
    sys.argv.append('py2exe')
#    sys.argv.append('-q')      # Quiet mode.

class Target:
    def __init__(self, **kw):
        self.__dict__.update(kw)
        # for the versioninfo resources
        self.version = "0.9.4.3"
        self.copyright = 'Copyright Stuart Rackham 2008'

docindexer = Target(
    name = 'docindexer',
    description = 'Document indexer COM server',
    modules = 'docindexer_win32com',
    create_dll = False,
)

docindex = Target(
    name = 'docindex',
    description = 'Document indexer command-line utility',
    script = 'docindex.py',
    icon_resources = [(1, 'docindex.ico')],
)

docsearch = Target(
    name = 'docsearch',
    description = 'Document searcher command-line utility',
    script = 'docsearch.py',
    icon_resources = [(1, 'docsearch.ico')],
)

excludes = [
    'pywin',
    'pywin.debugger',
    'pywin.debugger.dbgcon',
    'pywin.dialogs',
    'pywin.dialogs.list',
    'win32com.client'
]

# Not really necessary but suppresses warning messages.
ignores = [
    'win32com.client.build',
    'win32com.gen_py'
]

# Not really necessary but suppresses warning messages.
dll_excludes = [
    'OLEAUT32.dll',
    'USER32.dll',
    'SHELL32.dll',
    'ole32.dll',
    'ADVAPI32.dll',
    'msvcrt.dll',
    'WS2_32.DLL',
    'VERSION.dll',
    'KERNEL32.dll',
]

options = {
    'compressed': 1,      # create a compressed zip archive
    'excludes': excludes,
    'ignores': ignores,
    'dll_excludes': dll_excludes,
}

setup(
    options = {'py2exe': options},
    com_server = [docindexer],
    console = [docindex,docsearch],
)
